<html>
<head><meta charset="utf-8"><title>Conditional `must_use` again · t-lang · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/index.html">t-lang</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Conditional.20.60must_use.60.20again.html">Conditional `must_use` again</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214132182"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Conditional%20%60must_use%60%20again/near/214132182" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> scottmcm <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Conditional.20.60must_use.60.20again.html#214132182">(Oct 22 2020 at 00:40)</a>:</h4>
<p>A <a href="https://github.com/rust-lang/rust/pull/78182#discussion_r509431383">conversation about <code>ControlFlow</code></a> made this thought jump to mind: <code>Result&lt;_, !&gt;</code> doesn't really need to be <code>must_use</code>.</p>
<p>That's not at all risen to the level of a proposal, or even that I think it's necessarily a problem that needs solving, but it seemed interesting given previous conversations about whether wrapper types should inherit <code>must_use</code> from things.</p>



<a name="214146733"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Conditional%20%60must_use%60%20again/near/214146733" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Conditional.20.60must_use.60.20again.html#214146733">(Oct 22 2020 at 06:07)</a>:</h4>
<p>(I'll remind folks that <em>types</em> shouldn't be <code>must_use</code>, <em>return values</em> should be <code>must_use</code>.</p>
<p>Marking types as <code>must_use</code> is just a clumsy stand-in for blanket marking of certain return values as <code>must_use</code> by default.)</p>



<a name="214146838"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Conditional%20%60must_use%60%20again/near/214146838" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Josh Triplett <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Conditional.20.60must_use.60.20again.html#214146838">(Oct 22 2020 at 06:09)</a>:</h4>
<p>In most cases I agree, though if you have a type like Result or Future that'll always want to be marked as such, marking the type seems like a handy shortcut.</p>



<a name="214183591"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Conditional%20%60must_use%60%20again/near/214183591" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> simulacrum <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Conditional.20.60must_use.60.20again.html#214183591">(Oct 22 2020 at 13:08)</a>:</h4>
<p>It seems plausible that not just return values - e.g. I would want a block that "returns" Result to get caught too. So more like expressions with must_use type.</p>



<a name="214215443"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/213817-t-lang/topic/Conditional%20%60must_use%60%20again/near/214215443" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nikomatsakis <a href="https://rust-lang.github.io/zulip_archive/stream/213817-t-lang/topic/Conditional.20.60must_use.60.20again.html#214215443">(Oct 22 2020 at 16:52)</a>:</h4>
<p>I don't know that I agree, <span class="user-mention" data-user-id="224471">@Lokathor</span>, but also that doesn't really help with the problem. After all, <code>fn foo&lt;E&gt;(x: ...) -&gt; Result&lt;T, E&gt;</code> could be instantiated with <code>E = !</code>.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>